# -*- coding: utf-8 -*-

from util import create_class_instance


class Component(object):

    @staticmethod
    def create(class_name, cfg):
        return create_class_instance(class_name, cfg)

    def __init__(self, cfg):
        self.__container = cfg['worker']
        self._cfg = cfg['cfg']

        self._init()

    @property
    def _container(self):
        return self.__container

    def _init(self):
        pass

    def destroy(self):
        self._destroy()

        self._cfg = None

    def _destroy(self):
        pass
